package com.teamwe.movecard.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.HashMap;


@Data
@Component
@ApiModel(description = "统一返回对象")
public class Result {
    //请求状态
    @ApiModelProperty(notes = "请求状态", name = "status")
    private boolean status;
    //服务器响应携带的参数
    @ApiModelProperty(notes = "请求响应携带的参数", name = "params")
    private HashMap<String, Object> params = new HashMap<>();
    //补充描述
    @ApiModelProperty(notes = "请求的补充描述，一般请求状态为false时才会有补充描述", name = "describe")
    private String describe = "";

    public Result(){}

    public Result(boolean status){
        this.status = status;
    }

    public void addParam(String name, Object obj){
        this.params.put(name, obj);
    }
}
